<?php
declare (strict_types=1);

namespace app\middleware\auth;

use app\common\facade\auth\Auth;
use think\facade\Db;
use think\facade\Log;
use think\Response;

class AppAuth
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure $next
     */
    public function handle($request, \Closure $next)
    {
        //日志开放平台请求的日志
        $params = $request->all();
        Log::info('开放平台请求参数:'.json_encode($params) );

        if (!Auth::attempt($request->all())) {
            return fail('验签失败');
        }


       return $next($request);

    }
}
